package probe.sound.code;

import java.io.FileOutputStream;
import java.io.InputStream;

import probe.sound.resources.Resources;

public class ExtractHeader {
  public static void main(String[] args) throws Exception {
    InputStream wavIn = Resources.class.getResourceAsStream( "file48000.wav" );
    byte header[] = new byte[44];
    int bytesForHeader = wavIn.read( header );
    if (bytesForHeader != header.length) {
      throw new RuntimeException( "No header: size = " + bytesForHeader );
    }
    wavIn.close();
    
    FileOutputStream fout = new FileOutputStream( "/home/pompei/tmp/wave.header.bin" );
    
    fout.write( header );
    
    fout.close();
    
    System.out.println( "OK" );
  }
}
